package com.creditcmsplt.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.creditcmsplt.entity.CreditAuoth;

/**
 * 数据库操作DAO：creditauoth表 厂商授权表
 * @author 雷阳军
 *
 */
public interface CreditAuothMapper{

	@Select("SELECT user_id FROM t_credit_auoth WHERE vendor_key=#{vendor_key} AND vendor_secret=#{vendor_secret} AND STATUS=1  LIMIT 1")//AND TYPE=1
	public List<Integer> queryAuoth(@Param("vendor_key") String vendor_key,@Param("vendor_secret") String vendor_secret);
	
	
	@Select("SELECT user_id,vendor_key,vendor_secret,status,type,token FROM t_credit_auoth WHERE vendor_key=#{vendor_key} AND vendor_secret=#{vendor_secret} AND STATUS=1  LIMIT 1")//AND TYPE=0
	public List<CreditAuoth> queryToken(@Param("vendor_key") String vendor_key,@Param("vendor_secret") String vendor_secret);
	
	@Select("SELECT lo.credit_phone userid,lo.credit_password password,lo.credit_id FROM t_credit_auoth au,t_credit_user lo WHERE lo.credit_id=au.user_id and token=#{token} AND au.STATUS=1  and lo.credit_state=1 LIMIT 1")//AND au.TYPE=0
	public List<Map<String,Object>> checkToken(@Param("token") String token);
	
}
